package com.bwf.coll;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/23 10:23
 * @Copyright 博为峰
 */
public class CollectionDemo {
    public static void main(String[] args) {
//        m1();
//        m2();
//        m3();
        //查
        Collection collection = new ArrayList();
        collection.add("a");
        collection.add("b");

        System.out.println(collection.size());
    }

    //判断
    private static void m3() {
        Collection collection = new ArrayList();
        collection.add("a");
        collection.add("b");

        System.out.println(collection.isEmpty());
        System.out.println(collection.contains("a"));
    }
    //删
    private static void m2() {
        Collection collection = new ArrayList();
        collection.add("a");
        collection.add("b");
//        collection.remove("b");
        collection.clear();

        System.out.println(collection);
    }

    //增
    private static void m1() {
        Collection collection = new ArrayList();
        collection.add("a");
        collection.add("b");

        Collection collection2 = new ArrayList();
        collection2.add("c");
        collection2.add("d");

        collection.addAll(collection2);

        System.out.println(collection);
    }
}
